package com.zyl.Ecs.common.domain.device.vo;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.zyl.Ecs.common.utils.ObjectUtil;
import com.zyl.Ecs.common.domain.device.ext.RoomExt;
import lombok.Builder;
import lombok.Data;

/**
 * @version v1.0
 * @ProjectName: Ecs
 * @Package: com.zyl.Ecs.device.domain.vo
 * @ClassName: RoomVO
 * @Description TODO
 * @Author 翟玉龙
 * @Date 2024/12/5-9:35
 */
@Data
@Builder
public class RoomVO {

    @JsonProperty(value = "id")
    private Integer id;

    @JsonProperty(value = "name")
    private String name;

    public static RoomVO toVO(RoomExt roomExt) {
        if (ObjectUtil.isNull(roomExt)) {
            return null;
        }
        return RoomVO.builder()
                .id(roomExt.getId())
                .name(roomExt.getName())
                .build();
    }
}
